package sort;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.example.Main;

import java.io.IOException;

public class CountMapper extends Mapper<LongWritable, Text,LongWritable,Text> {
    @Override
    protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, LongWritable, Text>.Context context) throws IOException, InterruptedException {
        String line =value.toString();
        String[] words =line.split("\\s+");
        long newkey =Long.parseLong(words[1]);
        context.write(new LongWritable(newkey),new Text(words[0]));
    }
}
